<?php
    session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
        <title>Alterar Problema</title>
        <style type="text/css">@import "rafael.css";</style>
    </head>
    <body>
    <h1>Remover Exemplo</h1>
<?php
    $output=NULL;
    if (isset($_GET['cat']))
    {
        $output.="\n<p>Categoria: ".$_GET['cat']."</p>";
        if (isset($_GET['exemplo'])) $output.="<p>Exemplo nº: ".($_GET['exemplo']+1)."</p>";
    }
    else
    {
        $output.="\n<p>Erro, categoria invalida</p>";
        $output.="\n</body>\n</html>";
        echo $output;
        exit(1);
    }
    $arq_xml=DOMDocument::load('./user/'.$_SESSION['id_usuario'].'/biblioteca.xml');
    $x = $arq_xml->getelementsbytagname($_GET['cat']);
    if ($x->length <= $_GET['exemplo'])
    {
        $output.="\n<p>Erro, Exemplo inexistente na biblioteca</p>";
        echo $output;
        exit(2);
    }
    $i = $_GET['exemplo'];
    $desc = $x->item($i)->getelementsbytagname('description');
    $come = $x->item($i)->getelementsbytagname('comments');
    $refe = $x->item($i)->getelementsbytagname('reference');
    $output.="\n<form name=\"alterar\" action=\"remover.php\" method=\"post\">";
    $output.="\n<input type=\"hidden\" name=\"cat\" value=\"".$_GET['cat']."\">";
    $output.="\n<input type=\"hidden\" name=\"exemplo\" value=\"".$_GET['exemplo']."\">";
    $output.="\n<fieldset>";
    $output.="\n<legend>Dados gerais:</legend>";
    //$output.="\n<div class=\"entrada\">";
    if ($desc->length) $output.="\n<p>Descri&ccedil;&atilde;o: ".htmlentities(utf8_decode($desc->item(0)->nodeValue))."</p>";
    if ($come->length) $output.="\n<p>Coment&aacute;rios: ".htmlentities(utf8_decode($come->item(0)->nodeValue))."</p>";
    if ($refe->length) $output.="\n<p>Refer&ecirc;ncia: ".htmlentities(utf8_decode($refe->item(0)->nodeValue))."</p>";
    //$output.="\n</div>";
    $output.="\n</fieldset>";
    $output.="\n<fieldset>";
    $output.="\n<legend>Dados do problema:</legend>";
    switch ($_GET['cat'])
    {
        case 'floatp':
            $base = $x->item($i)->getelementsbytagname('base');
            $mant = $x->item($i)->getelementsbytagname('mantissa');
            $expo = $x->item($i)->getelementsbytagname('exponent');
            $lowe = $expo->item(0)->getelementsbytagname('lower');
            $uppe = $expo->item(0)->getelementsbytagname('upper');
            $deci = $x->item($i)->getelementsbytagname('decimal');
            $output.="\n<div class=\"entrada\">";
            if ($deci->length) $xis = $deci->item(0)->getelementsbytagname('x');
            if ($base->length) $output.="\n<p>Base: ".$base->item(0)->nodeValue."</p>";
            if ($mant->length) $output.="\n<p>Mantissa: ".$mant->item(0)->nodeValue."</p>";
            if ($lowe->length) $output.="\n<p>Expoente inf: ".$lowe->item(0)->nodeValue."</p>";
            if ($uppe->length) $output.="\n<p>Expoente sup: ".$uppe->item(0)->nodeValue."</p>";
            if ($deci->length)
            {
                if ($xis->length > 1)
                {
                    $output.="\n<p>Decimal 1: ".$xis->item(0)->nodeValue."</p>";
                    $output.="\n<p>Decimal 2: ".$xis->item(1)->nodeValue."</p>";
                }
            }
            break;
        case 'matrix':
            $dim = $x->item($i)->getelementsbytagname('dim');
            $numrows = $x->item($i)->getelementsbytagname('num_rows');
            $numcols = $x->item($i)->getelementsbytagname('num_cols');
            $output.="\n<div class=\"centro\">";
            if ($dim->length) // determinante, inversao, definida positiva, decomposicao de matrizes
            {
                $rows = $x->item($i)->getelementsbytagname('row');
                $output.="\n<p>Matriz:</p>";
                $output.="\n<p><table border=\"0\" align=\"center\">";
                for ($j=0; $j<$rows->length; $j++)
                {
                    $cols = $rows->item($j)->getelementsbytagname('x');
                    $output.="\n<tr>";
                    for ($k=0; $k<$cols->length; $k++)
                    {
                        $output.="\n<td><p>";
                        $output.=$cols->item($k)->nodeValue."";
                        $output.="</p></td>";
                    }
                    $output.="\n</tr>";
                }
                $output.="\n</table></p>";
            }
            else
            {
                if ($numrows->length == 1) //soma de matrizes
                {
                    $output.="\n<p>Matriz 1</p>";
                    $output.="\n<table border=\"0\" align=\"center\">";
                    $rows = $x->item($i)->getelementsbytagname('row');
                    for ($j=0; $j<$numrows->item(0)->nodeValue; $j++)
                    {
                        $cols = $rows->item($j)->getelementsbytagname('x');
                        $output.="\n<tr>";
                        for ($k=0; $k<$numcols->item(0)->nodeValue; $k++)
                        {
                            $output.="<td><p>".$cols->item($k)->nodeValue."</p></td>";
                        }
                        $output.="\n</tr>";
                    }
                    $output.="\n</table>";
                    $output.="\n<p>Matriz 2</p>";
                    $output.="\n<table border=\"0\" align=\"center\">";
                    for ($j=$numrows->item(0)->nodeValue; $j<($numrows->item(0)->nodeValue*2); $j++)
                    {
                        $cols = $rows->item($j)->getelementsbytagname('x');
                        $output.="\n<tr>";
                        for ($k=0; $k<$numcols->item(0)->nodeValue; $k++)
                        {
                            $output.="<td><p>".$cols->item($k)->nodeValue."</p></td>";
                        }
                        $output.="\n</tr>";
                    }
                    $output.="\n</table>";
                }
                else //multiplicacao de matrizes
                {
                    $output.="\n<p>Matriz 1</p>";
                    $output.="\n<table border=\"0\" align=\"center\">";
                    $rows = $x->item($i)->getelementsbytagname('row');
                    for ($j=0; $j<$numrows->item(0)->nodeValue; $j++)
                    {
                        $cols = $rows->item($j)->getelementsbytagname('x');
                        $output.="\n<tr>";
                        for ($k=0; $k<$numcols->item(0)->nodeValue; $k++)
                        {
                            $output.="<td><p>".$cols->item($k)->nodeValue."</p></td>";
                        }
                        $output.="\n</tr>";
                    }
                    $output.="\n</table>";
                    $output.="\n<p>Matriz 2</p>";
                    $output.="\n<table border=\"0\" align=\"center\">";
                    for ($j=$numrows->item(0)->nodeValue; $j<($numrows->item(0)->nodeValue+$numrows->item(1)->nodeValue); $j++)
                    {
                        $cols = $rows->item($j)->getelementsbytagname('x');
                        $output.="\n<tr>";
                        for ($k=0; $k<$numcols->item(1)->nodeValue; $k++)
                        {
                            $output.="<td><p>".$cols->item($k)->nodeValue."</p></td>";
                        }
                        $output.="\n</tr>";
                    }
                    $output.="\n</table>";
                }
            }
            break;
        case 'system':
            $meto = $x->item($i)->getelementsbytagname('method');
            $rows = $x->item($i)->getelementsbytagname('row');
            $prop = $x->item($i)->getelementsbytagname('properties');
            $dime = $x->item($i)->getelementsbytagname('dim');
            if ($meto->length && $meto->item(0)->nodeValue == 'iterative')
            {
                $maxi = $x->item($i)->getelementsbytagname('maxiter');
                $epsi = $x->item($i)->getelementsbytagname('epsilon');
                $init = $x->item($i)->getelementsbytagname('initial_vector');
                $vini = $init->item(0)->getelementsbytagname('x');
            }
            $cols = array();
            for ($j=0; $j<$rows->length; $j++)
            {
                $cols[$j] = $rows->item($j)->getelementsbytagname('x');
            }
            for ($j=0; $j<$prop->length; $j++)
            {
                if ($prop->item($j)->hasAttribute('type_solution')) $typesolution = $prop->item($j)->getAttribute('type_solution');
                if ($prop->item($j)->hasAttribute('symetric')) $symetric = $prop->item($j)->getAttribute('symetric');
                if ($prop->item($j)->hasAttribute('sparsity')) $sparsity = $prop->item($j)->getAttribute('sparsity');
                if ($prop->item($j)->hasAttribute('positive_definite')) $positivedefinite=$prop->item($j)->getAttribute('positive_definite');
                if ($prop->item($j)->hasAttribute('diagonally_dominant')) $diagonally_dominant=$prop->item($j)->getAttribute('diagonally_dominant');
            }
            $output.="\n<div class=\"entrada\">";
            if ($meto->length) $output.="\n<p>M&eacute;todo: ".$meto->item(0)->nodeValue."</p>";
            if (isset($maxi) && $maxi->length) $output.="\n<p>Itera&ccedil;&otilde;es: ".$maxi->item(0)->nodeValue."</p>";
            if (isset($epsi) && $epsi->length) $output.="\n<p>Erro: ".$epsi->item(0)->nodeValue."</p>";
            $output.="\n</div>\n<div class=\"centro\">";
            for ($j=0; $j<$rows->length; $j++)
            {
                if ($cols[$j]->length)
                {
                    $output.="\n<p>";
                    for ($k=0; $k<$cols[$j]->length; $k++)
                    {
                        $output.=$cols[$j]->item($k)->nodeValue;
                        if ($k != ($cols[$j]->length - 1)) $output.=" X<sub>$k</sub>";
                        if ($k < ($cols[$j]->length - 2)) $output.=" + ";
                        if ($k == ($cols[$j]->length - 2)) $output.=" = ";
                    }
                    $output.="</p>";
                }
            }
            if (isset($init))
            {
                $output.="\n<p>Vetor Inicial</p>\n<p>";
                for ($j=0; $j<$vini->length; $j++)
                {
                    $output.=$vini->item($j)->nodeValue;
                }
                $output.="</p>";
            }
            $output.="\n<p>Tipo de solucao:".(($typesolution == 'compatible_determined')?' SPD':(($typesolution == 'compatible_undetermined')?' SPI':' SI'))."</p>";
            $output.="\n<p><label for=\"sim\">Sim&eacute;trico</label><input id=\"sim\" type=\"checkbox\" name=\"symetric\"".(($symetric == 'symetric')?' checked':'').">";
            $output.="\n<p><label for=\"spa\">Esparso</label><input id=\"spa\" type=\"checkbox\" name=\"sparsity\"".(($sparsity == 'sparse')?' checked':'').">";
            $output.="\n<p><label for=\"dpos\">Definido positivo</label><input id=\"dpos\" type=\"checkbox\" name=\"defpos\"".(($positivedefinite == 'positive_definite')?' checked':'').">";
            $output.="\n<p><label for=\"ddom\">Diagonalmente dominante</label><input id=\"ddom\" type=\"checkbox\" name=\"diagdominante\"".(($diagonally_dominant == 'diagonally_dominant')?' checked':'').">";
            break;
        case 'interpol':
            $opt = $x->item($i)->getelementsbytagname('options');
            $nump = $x->item($i)->getelementsbytagname('num_points');
            $valor = $x->item($i)->getelementsbytagname('interpol_value');
            $output.="\n<div class=\"centro\">";
            if ($opt->length > 1)
            {
                $dist = $opt->item(1)->getAttribute('distribution');
                $func = $x->item($i)->getelementsbytagname('function');
                $int = $x->item($i)->getelementsbytagname('interval');
                $int1 = $int->item(0)->getelementsbytagname('x');
                $int2 = $int->item(0)->getelementsbytagname('y');
                $output.="\n<p>Caso cont&iacute;nuo</p>";
                $output.="\n<p>Distribui&ccedil;&atilde;o:</p>";
                $output.="\n<p><label for=\"unif\">Uniforme</label><input id=\"unif\" type=\"radio\" name=\"dist\" value=\"uniform\"".(($dist=='uniform')?' checked':'')."><label for=\"cheb\">Chebyshev</label><input id=\"cheb\" type=\"radio\" name=\"dist\" value=\"chebyshev\"".(($dist=='uniform')?'':' checked')."></p>";
                $output.="\n</div>\n<div class=\"entrada\">";
                $output.="\n<p>N&uacute;mero de pontos: <input type=\"text\" name=\"numpoint\" value=\"".$nump->item(0)->nodeValue."\"></p>";
                $output.="\n<p>Ponto a ser interpolado: <input type=\"text\" name=\"intvalue\" value=\"".$valor->item(0)->nodeValue."\"></p>";
                $output.="\n<p>Funcao: <input type=\"text\" name=\"funcao\" value=\"".$func->item(0)->nodeValue."\"></p>";
                $output.="\n<p>Intervalo: <input type=\"text\" name=\"int1\" value=\"".$int1->item(0)->nodeValue."\" size=\"9\"><input type=\"text\" name=\"int2\" value=\"".$int2->item(0)->nodeValue."\" size=\"9\"></p>";
                $output.="\n<input type=\"hidden\" name=\"caso\" value=\"continuo\">";
            }
            elseif ($opt->length == 1)
            {
                $ponto = $x->item($i)->getelementsbytagname('point');
                for ($j=0; $j<$ponto->length; $j++)
                {
                    $point[$j]['x'] = $ponto->item($j)->getelementsbytagname('x');
                    $point[$j]['y'] = $ponto->item($j)->getelementsbytagname('y');
                }
                $output.="\n<p>Caso discreto</p>";
                $output.="\n</div>\n<div class=\"entrada\">";
                $output.="\n<p>N&uacute;mero de pontos: <input type=\"text\" name=\"numpoint\" value=\"".$nump->item(0)->nodeValue."\" readonly=\"readonly\"></p>";
                $output.="\n<p>Ponto a ser interpolado: <input type=\"text\" name=\"intvalue\" value=\"".$valor->item(0)->nodeValue."\"></p>";
                $output.="\n</div>\n<div class=\"centro\">";
                $output.="\n<p>Coordenada dos pontos:</p>";
                for ($j=0; $j<$ponto->length; $j++)
                {
                    $output.="\n<p>[<input type=\"text\" name=\"pontox[$j]\" value=\"".$point[$j]['x']->item(0)->nodeValue."\" size=\"4\">,<input type=\"text\" name=\"pontoy[$j]\" value=\"".$point[$j]['y']->item(0)->nodeValue."\" size=\"4\">]</p>";
                }
                $output.="\n<input type=\"hidden\" name=\"caso\" value=\"discreto\">";
            }
            break;
        case 'datafit':
            $opt = $x->item($i)->getelementsbytagname('options');
            $dados = $opt->item(0)->getAttribute('data');
            $degree = $x->item($i)->getelementsbytagname('degree');
            switch ($dados)
            {
                case 'discrete':
                    $nump = $x->item($i)->getelementsbytagname('num_points');
                    $points = $x->item($i)->getelementsbytagname('point');
                    $output.="\n<div class=\"centro\">\n<p>Caso discreto</p>";
                    $output.="\n<p>N&uacute;mero de pontos: ".$nump->item(0)->nodeValue."</p>";
                    $output.="\n<p>Coordenada dos pontos:</p>";
                    for ($j=0; $j<$points->length; $j++)
                    {
                        $px = $points->item($j)->getelementsbytagname('x')->item(0)->nodeValue;
                        $py = $points->item($j)->getelementsbytagname('y')->item(0)->nodeValue;
                        $output.="\n<p>[<input type=\"text\" name=\"pontox[$j]\" value=\"$px\" size=\"4\">,<input type=\"text\" name=\"pontoy[$j]\" value=\"$py\" size=\"4\">]</p>";
                    }
                    $output.="\n</div><div class=\"entrada\">";
                    break;
                case 'continuous':
                    $funcao = $x->item($i)->getelementsbytagname('function');
                    $interv = $x->item($i)->getelementsbytagname('interval');
                    $int1 = $interv->item(0)->getelementsbytagname('x');
                    $int2 = $interv->item(0)->getelementsbytagname('y');
                    $output.="\n<p class=\"centro\">Caso cont&iacute;nuo</p>";
                    $output.="\n</div><div class=\"entrada\">";
                    $output.="\n<p>Fun&ccedil;&atilde;o <input type=\"text\" name=\"funcao\" value=\"".$funcao->item(0)->nodeValue."\"></p>";
                    $output.="\n<p>Intervalo: <input type=\"text\" name=\"int1\" value=\"".$int1->item(0)->nodeValue."\" size=\"9\"><input type=\"text\" name=\"int2\" value=\"".$int2->item(0)->nodeValue."\" size=\"9\"></p>";
                    break;
            }
            $output.="\n<p>Grau do polin&ocirc;mio: <input type=\"text\" name=\"degree\" value=\"".$degree->item(0)->nodeValue."\"></p>";
            break;
        case 'equation':
            $opt = $x->item($i)->getelementsbytagname('option');
            $tipo = $opt->item(0)->getAttribute('data');
            $maxiter = $x->item($i)->getelementsbytagname('maxiter');
            $erro = $x->item($i)->getelementsbytagname('error');
            $grau = $x->item($i)->getelementsbytagname('degree');
            if ($grau->length)
                for ($j=0; $j<=$grau->item(0)->nodeValue; $j++)
                    $coef[$j] = $x->item($i)->getelementsbytagname('coef')->item($j);
            $function = $x->item($i)->getelementsbytagname('function');
            $interv = $x->item($i)->getelementsbytagname('interval');
            if ($interv->length)
            {
                $int1 = $interv->item(0)->getelementsbytagname('x');
                $int2 = $interv->item(0)->getelementsbytagname('y');
            }
            $initv = $x->item($i)->getelementsbytagname('initial_vector');
            if ($initv->length) $vinic = $initv->item(0)->getelementsbytagname('x');
            $output.="\n<div class=\"centro\">";
            $output.="\n<p>Tipo de dados: ".$tipo."</p>";
            if ($grau->length)
            {
                $output.="\n<p>Grau do polin&ocirc;mio: ".$grau->item(0)->nodeValue."</p>";
                $output.="\n<p>f(x) = ";
                for ($j=0; $j<=$grau->item(0)->nodeValue;$j++)
                    $output.="<input type=\"text\" name=\"coef[$j]\" value=\"".$coef[$j]->nodeValue."\" size=\"2\">x<sup>".($grau->item(0)->nodeValue-$j)."</sup>".(($grau->item(0)->nodeValue != $j)?' + ':'');
                $output.="</p>";
            }
            if ($function->length)
            {
                $output.="\n</div><div class=\"entrada\">\n<p>f(x) = <input type=\"text\" name=\"function\" value=\"".$function->item(0)->nodeValue."\"></p>";
            }
            $output.="\n</div>\n<div class=\"entrada\">";
            $output.="\n<p>Itera&ccedil;&otilde;es: <input type=\"text\" name=\"mxiter\" value=\"".$maxiter->item(0)->nodeValue."\"></p>";
            $output.="\n<p>Erro: <input type=\"text\" name=\"error\" value=\"".$erro->item(0)->nodeValue."\"></p>";         
            if ($interv->length)
            {
                $output.="\n<p>Intervalo: <input type=\"text\" name=\"int1\" value=\"".$int1->item(0)->nodeValue."\" size=\"9\"><input type=\"text\" name=\"int2\" value=\"".$int2->item(0)->nodeValue."\" size=\"9\"></p>";
            }
            if ($initv->length)
            {
                $output.="\n<p class=\"centro\">Valores iniciais:</p>";
                for ($j=0; $j<$vinic->length; $j++)
                {
                    $output.="\n<p>x<sub>$j</sub> <input type=\"text\" name=\"vinic[$j]\" value=\"".$vinic->item($j)->nodeValue."\"></p>";
                }
            }
            break;
        case 'nl_system':
            $dim = $x->item($i)->getelementsbytagname('dim');
            $maxiter = $x->item($i)->getelementsbytagname('maxiter');
            $erro = $x->item($i)->getelementsbytagname('epsilon');
            $linha = $x->item($i)->getelementsbytagname('nl_row');
            $output.="\n<div class=\"entrada\">";
            $output.="\n<p>Dimens&atilde;o: <input type=\"text\" name=\"dim\" value=\"".$dim->item(0)->nodeValue."\" readonly=\"readonly\"></p>";
            $output.="\n<p>Erro k, para x<sup>-k</sup>: <input type=\"text\" name=\"erro\" value=\"".$erro->item(0)->nodeValue."\"></p>";
            $output.="\n<p>Itera&ccedil;&otilde;es <input type=\"text\" name=\"mxiter\" value=\"".$maxiter->item(0)->nodeValue."\"></p>";
            for ($j=0; $j<$linha->length; $j++)
            {
                $coef = $linha->item($j)->getelementsbytagname('x');
                $exp = $linha->item($j)->getelementsbytagname('exp');
                $k=0;
                $output.="\n<p>";
                foreach($exp as $ex)
                {
                    $output.=(($k)?' + ':'')."<input type=\"text\" name=\"coef[$j][".$k."]\" value=\"".$coef->item($k)->nodeValue."\" size=\"1\">x<sub>$k</sub><sup><input type=\"text\" name=\"exp[$j][".$k++."]\" value=\"".$ex->nodeValue."\" size=\"1\"></sup>";
                }
                $output.=" = <input type=\"text\" name=\"res[$j]\" value=\"".$coef->item($coef->length-1)->nodeValue."\" size=\"1\">";
                $output.="</p>";
            }
            $vinic = $x->item($i)->getelementsbytagname('initial_vector');
            $vx = $vinic->item(0)->getelementsbytagname('x');
            $output.="\n<p class=\"centro\">Vetor inicial</p>";
            for ($j=0; $j<$vx->length;$j++)
            {
                $output.="\n<p>x<sub>$j</sub> <input type=\"text\" name=\"vinic[$j]\" value=\"".$vx->item($j)->nodeValue."\"></p>";
            }
            $prop = $x->item($i)->getelementsbytagname('properties');
            for ($j=0; $j<$prop->length; $j++)
            {
                if ($prop->item($j)->hasAttribute('type_solution')) $typesolution = $prop->item($j)->getAttribute('type_solution');
                if ($prop->item($j)->hasAttribute('symetric')) $symetric = $prop->item($j)->getAttribute('symetric');
                if ($prop->item($j)->hasAttribute('sparsity')) $sparsity = $prop->item($j)->getAttribute('sparsity');
                if ($prop->item($j)->hasAttribute('positive_definite')) $positivedefinite=$prop->item($j)->getAttribute('positive_definite');
                if ($prop->item($j)->hasAttribute('diagonally_dominant')) $diagonally_dominant=$prop->item($j)->getAttribute('diagonally_dominant');
            }
            $output.="\n</div>\n<div class=\"centro\">\n<p>Tipo de solucao</p>";
            $output.="\n<p><label for=\"spd\">SPD</label><input id=\"spd\" type=\"radio\" name=\"tiposolucao\" value=\"1\"".(($typesolution == 'compatible_determined')?' checked':'').">";
            $output.="<label for=\"spi\">SPI</label><input id=\"spi\" type=\"radio\" name=\"tiposolucao\" value=\"2\"".(($typesolution == 'compatible_undetermined')?' checked':'').">";
            $output.="<label for=\"si\">SI</label><input id=\"si\" type=\"radio\" name=\"tiposolucao\" value=\"3\"".(($typesolution == 'unsolvable')?' checked':'').">";
            $output.="</p>";
            $output.="\n<p><label for=\"sim\">Sim&eacute;trico</label><input id=\"sim\" type=\"checkbox\" name=\"symetric\"".(($symetric == 'symetric')?' checked':'').">";
            $output.="\n<p><label for=\"spa\">Esparso</label><input id=\"spa\" type=\"checkbox\" name=\"sparsity\"".(($sparsity == 'sparse')?' checked':'').">";
            $output.="\n<p><label for=\"dpos\">Definido positivo</label><input id=\"dpos\" type=\"checkbox\" name=\"defpos\"".(($positivedefinite == 'positive_definite')?' checked':'').">";
            $output.="\n<p><label for=\"ddom\">Diagonalmente dominante</label><input id=\"ddom\" type=\"checkbox\" name=\"diagdominante\"".(($diagonally_dominant == 'diagonally_dominant')?' checked':'').">";
            break;
        case 'derivate':
            $func = $x->item($i)->getelementsbytagname('function');
            $init = $x->item($i)->getelementsbytagname('initial_value');
            $iter = $x->item($i)->getelementsbytagname('maxiter');
            $erro = $x->item($i)->getelementsbytagname('error');
            $output.="\n<div class=\"entrada\">";
            $output.="\n<p>Fun&ccedil;&atilde;o: <input type=\"text\" name=\"funcao\" value=\"".$func->item(0)->nodeValue."\"></p>";
            $output.="\n<p>f(x), para x = <input type=\"text\" name=\"vinicial\" value=\"".$init->item(0)->nodeValue."\"></p>";
            $output.="\n<p>Itera&ccedil;&otilde;es: <input type=\"text\" name=\"maxiter\" value=\"".$iter->item(0)->nodeValue."\"></p>";
            $output.="\n<p>Erro relativo: <input type=\"text\" name=\"erro\" value=\"".$erro->item(0)->nodeValue."\"></p>";
            break;
        case 'integrate':
            $func = $x->item($i)->getelementsbytagname('function');
            $limit = $x->item($i)->getelementsbytagname('limit');
            $a = $limit->item(0)->getelementsbytagname('a')->item(0)->nodeValue;
            $b = $limit->item(0)->getelementsbytagname('b')->item(0)->nodeValue;
            $part = $x->item($i)->getelementsbytagname('partitions');
            $n = $part->item(0)->getelementsbytagname('n')->item(0)->nodeValue;
            $m = $part->item(0)->getelementsbytagname('m')->item(0)->nodeValue;
            $output.="\n<div class=\"entrada\">";
            $output.="\n<p>Fun&ccedil;&atilde;o <input type=\"text\" name=\"funcao\" value=\"".$func->item(0)->nodeValue."\"></p>";
            $output.="\n<p>Limite inferior (a): <input type=\"text\" name=\"a\" value=\"".$a."\"></p>";
            $output.="\n<p>Limite superior (b): <input type=\"text\" name=\"b\" value=\"".$b."\"></p>";
            $output.="\n<p>Nº par de parti&ccedil;&otilde;es (n): <input type=\"text\" name=\"n\" value=\"".$n."\" size=\"12\"></p>";
            $output.="\n<p>Nº par de parti&ccedil;&otilde;es (m / m>n): <input type=\"text\" name=\"m\" value=\"".$m."\" size=\"12\"></p>";
            break;
        default:
            $output.="<p>Se&ccedil;&atilde;o inv&aacute;lida</p>";
    }
    $output.="\n</div>";
    $output.="\n</fieldset>";
    $output.="\n<input type=\"submit\" value=\"Remover\" name=\"alt\">";
    $output.="\n</form>";
    $output.="<p><a href=\"./remocao.php\">Voltar</a></p>";
    echo $output;
?>

    </body>
</html>
